/**
 * @see https://umijs.org/zh-CN/plugins/plugin-access
 * */
export default function access(currentUser: AccountData.CurrentAccountVo
) {

  const permissionsArray = currentUser.permissions || [];
  const permissionsStr = permissionsArray.toString() || '';
  const admin = permissionsStr.indexOf('admin') !== -1;

  return {
    showAdmin: admin,

    /**
     * ======================================================================================
     * 选题管理
     * ======================================================================================
     */
    showCues: permissionsStr.indexOf('cues') > -1,

    /**
     *  线索征集
     */
    showCuesTopic: permissionsStr.indexOf('cues:topic') > -1,

    cuesTopicConfigManage: permissionsArray.includes('cues:topic:config:manage'),//线索征集x配置x管理员
    cuesTopicConfigNeedDepartment: permissionsArray.includes('cues:topic:config:need:department'),//线索征集x配置x部门需求者
    cuesTopicConfigNeedMedia: permissionsArray.includes('cues:topic:config:need:media'),//线索征集x配置x媒体需求者
    cuesTopicConfigRender: permissionsArray.includes('cues:topic:config:render'),//线索征集x配置x提供者

    cuesTopicAdd: permissionsArray.includes('cues:topic:add'),  //线索征集x创建选题计划

    cuesTopicSubmitPage: permissionsArray.includes('cues:topic:submit:page'), //线索征集x上报线索x页面
    cuesTopicSubmitAttachment: permissionsArray.indexOf('cues:topic:submit:attachment') > -1,// 线索征集x上报线索x附件
    cuesTopicTubmitAttachmentPicture: permissionsArray.includes('cues:topic:submit:attachment:picture'),//线索征集x上报线索x附件x图片
    cuesTopicSubmitAttachmentVideo: permissionsArray.includes('cues:topic:submit:attachment:video'),//线索征集x上报线索x附件x视频
    cuesTopicSubmitAttachmentOffice: permissionsArray.includes('cues:topic:submit:attachment:office'),//线索征集x上报线索x附件x办公
    cuesTopicSubmitAttachmentOther: permissionsArray.includes('cues:topic:submit:attachment:other'),//线索征集x上报线索x附件x其他
    /**
     *  主动报送
     */
    showCuesActive: permissionsStr.indexOf('cues:active') > -1,//主动报送
    cuesActivePage: permissionsArray.includes('cues:active:page'),//主动报送x页面
    cuesActiveConfigManage: permissionsArray.includes('cues:active:config:manage'),//主动报送x配置x管理员
    cuesActiveConfigNeed: permissionsArray.includes('cues:active:config:need'),//主动报送x配置x接收者
    cuesActiveConfigRender: permissionsArray.includes('cues:active:config:render'),// 主动报送x配置x提供者

    cuesActiveSubmitPage: permissionsArray.includes('cues:active:submit:page'),//主动报送x上报线索x页面
    cuesActiveSubmitAttachment: permissionsArray.indexOf('cues:active:submit:attachment') > -1,//主动报送x上报线索x附件
    cuesActiveSubmitAttachmentPicture: permissionsArray.includes('cues:active:submit:attachment:picture'),//主动报送x上报线索x附件x图片
    cuesActiveSubmitAttachmentVideo: permissionsArray.includes('cues:active:submit:attachment:video'),//主动报送x上报线索x附件x视频
    cuesActiveSubmitAttachmentOffice: permissionsArray.includes('cues:active:submit:attachment:office'),//主动报送x上报线索x附件x办公
    cuesActiveSubmitAttachmentOther: permissionsArray.includes('cues:active:submit:attachment:other'),//主动报送x上报线索x附件x其他
    /**
       * ======================================================================================
       * 宣传指令
       * ======================================================================================
      */
    showInstruct: permissionsStr.indexOf('instruct') > -1,//宣传指令

    instructPage: permissionsArray.includes('instruct:page'),//宣传指令x页面

    instructConfigManage: permissionsArray.includes('instruct:config:manage'),//宣传指令x配置x管理员
    instructConfigRecipient: permissionsArray.includes('instruct:config:recipient'),//宣传指令x配置x接收者

    instructAddress: permissionsArray.includes('instruct:address'),//宣传指令x通讯录
    instructAdd: permissionsArray.includes('instruct:add'),//宣传指令x发布指令

    instructSubmitPage: permissionsArray.includes('instruct:submit:page'),//宣传指令x发布指令x页面
    instructSubmitAttachment: permissionsArray.indexOf('instruct:submit:attachment') > -1,//宣传指令x发布指令x附件
    instructSubmitAttachmentPicture: permissionsArray.includes('instruct:submit:attachment:picture'),//宣传指令x发布指令x附件x图片
    instructSubmitAttachmentVideo: permissionsArray.includes('instruct:submit:attachment:video'),//宣传指令x发布指令x附件x视频
    instructSubmitAttachmentOffice: permissionsArray.includes('instruct:submit:attachment:office'),// 宣传指令x发布指令x附件x办公
    instructSubmitAttachmentOther: permissionsArray.includes('instruct:submit:attachment:other'),//宣传指令x发布指令x附件x其他

    /**
    *  数据分析
    */
    showCuesAnalysis: permissionsStr.indexOf('cues:analysis') > -1,

    cuesAnalysisPage: permissionsArray.includes('cues:analysis:page'),//数据分析
    /**
     * ======================================================================================
     * 全媒体质效考核
     * ======================================================================================
     */
    showExamine: permissionsStr.indexOf('instruct') > -1,
    examinePage: permissionsArray.includes('examine:page'),//全媒体质效考核x页面

    showAssess: permissionsStr.indexOf('assess') > -1,
    assessPage: permissionsArray.includes('assess:page'),//质效考核x页面
    assessConfigManage: permissionsArray.includes('assess:config:manage'),//质效评估x配置x管理员
    assessConfigRender: permissionsArray.includes('assess:config:render'),//质效评估x配置x提供者
    assessSource: permissionsArray.includes('assess:source'),//质效评估x来源

    assessCreatePage: permissionsArray.includes('assess:create:page'),//质效评估x创建x页面
    assessCreateAttachment: permissionsArray.indexOf('assess:create:attachment') > -1,//质效评估x创建x附件
    assessCreateAttachmentPicture: permissionsArray.includes('assess:create:attachment:picture'),//质效评估x创建x附件x图片
    assessCreateAttachmentVideo: permissionsArray.includes('assess:create:attachment:video'),//质效评估x创建x附件x视频
    assessCreateAttachmentOffice: permissionsArray.includes('assess:create:attachment:office'),//质效评估x创建x附件x办公
    assessCreateAttachmentOther: permissionsArray.includes('assess:create:attachment:other'),//质效评估x创建x附件x其他

    assessUpdate: permissionsArray.includes('assess:update'),//质效评估x更新
    assessExamine: permissionsArray.includes('assess:examine'),//质效评估x考核
    /**
     * ======================================================================================
     * 大数据
     * ======================================================================================
     */
    showBigdata: permissionsStr.indexOf('bigdata') > -1,
    bigdataPage: permissionsArray.includes('bigdata:page'),//大数据x页面

    /**
     * ======================================================================================
     * 工具集
     * ======================================================================================
     */
    showTool: permissionsStr.indexOf('tool') > -1,
    toolPage: permissionsArray.includes('tool:page'),// 工具集x页面

    /**
     * ======================================================================================
     * 设置
     * ======================================================================================
     */
    showSetting: permissionsStr.indexOf('setting') > -1,


  };
}